#!/usr/bin/python

import sys
from Bio import SeqIO

seqdict = SeqIO.index(sys.argv[1], "qual")

listfile = sys.argv[2]
te = open(listfile, "rU")
toextract = te.readlines()

for e in toextract:
    s = e.strip()
    if s in seqdict:
        print seqdict[s].format("qual").strip("\n") #removes blank line between records

te.close()
